import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import Es6Promise from 'es6-promise';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import api from './api/index';
import nav from './config/NavConfig';
import components from './componentsChild/index';
import echarts from 'echarts';
import common from './common/common';
import mapapi from './config/MapApiconfig';               //   接口列表
new common(Vue);                                          //   实例化公共方法  全局挂载
import route_ from './common/route';
new route_(Vue);                                          //   路由全局处理
import previewImg from 'vue-preview-img'                  //   图片预览插件
import VuePreview from 'vue-preview'                      //   图片预览插件
import '../node_modules/vue-preview-img/lib/vue-preview-img.css'
import config_    from './config/config';                 //   配置文件
Vue.use(previewImg);                                      //   图片阅览
Vue.use(VuePreview);
import moment from 'moment';                              //   时间操作模块
Vue.prototype.$moment = moment;


Vue.use(ElementUI);
Vue.prototype.$echarts = echarts
// Vue.prototype.$nav=nav;
Vue.prototype.$api = api;
Vue.prototype.$mapapi = mapapi;
Vue.prototype.$message = ElementUI.Message;
Vue.prototype.$config  = config_;
Es6Promise.polyfill();
Vue.config.productionTip = false;
components(Vue);


//刚开始第一次进入页面的时候，为了防止拿不到之前保留的token，先取拿一次内存
localStorage.getItem("store") && store.replaceState(Object.assign(store.state, JSON.parse(localStorage.getItem("store"))));



new Vue({
  router,
  store,
  created() {

  },
  render: h => h(App)
}).$mount("#app");
